package com.lw.test.codewars;

import java.util.*;

/**
 * create by idea
 *
 * @author lmx
 * @version 1.0
 * @date 2022/3/13 21:29
 */
public class Arrarylist {

    //  ["az", "toto", "picaro", "zone", "kiwi"] -->
    //[["az", "toto picaro zone kiwi"],
    // ["az toto", "picaro zone kiwi"],
    // ["az toto picaro", "zone kiwi"],
    // ["az toto picaro zone", "kiwi"]]

    private static void stringRe() {
        String str = "dgdhgjdgdg";
        int length = str.length();
        char[] chars = str.toCharArray();
        int mid = chars.length >> 1;
        for (int i = 0; i < mid; i++) {
            char c=chars[i];
            chars[i] =chars[length-1-i];
            chars[length-1-i]=c;

        }
        System.out.println(String.valueOf(chars));

    }

    public  static void stringTest(){
        String str = "ddjghfngfgf";
        str.substring(0,2);
        String s = str.toLowerCase();
        String s1 = str.toUpperCase();
        boolean a = str.startsWith("a");
        char[] chars = str.toCharArray();
        byte[] bytes = str.getBytes();
        String replace = str.replace("a","b");
        String s2 = String.valueOf(1);


    }

    static void stackTest(){
        Stack<Integer> stack = new Stack();
        stack.add(5);
        stack.add(6);
        Integer peek = stack.peek();
        Integer pop = stack.pop();
    }


    private static void  listTest(){
        ArrayList<Integer> list = new ArrayList<>();
        list.add(2);
        list.add(3);
        for (Integer integer : list) {
            System.out.println(integer);
        }

        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }

        list.set(0,2);
    }



    private  static void mapTest(){
        HashMap<String, String> map = new HashMap<>();
        map.put("a","1");
        map.put("b","2");
        map.put("c","3");

        for (Map.Entry<String, String> entry : map.entrySet()) {

            System.out.println(entry.getKey());
        }

        Set<String> strings = map.keySet();
        for (String string : strings) {
            System.out.println(string);
        }
    }


}
